return c1;
}
-/* %%% cet_valid_char %%%
- *
- * returnes 1 if convertable otherwise 0
- *
- */
-
-int
-cet_valid_char(const char* src, const cet_cs_vec_t* vec)
-{
- int value;
-
- const cet_cs_vec_t* v = (vec != NULL) ? vec : &cet_cs_vec_ansi_x3_4_1968;
- return cet_char_to_ucs4(*src, v, &value);
-}
-
-
-#ifdef DEBUG_MEM
-
-void
-cet_check_cs(cet_cs_vec_t* vec) /* test well sorted link & extra tables */
-{
- cet_ucs4_link_t* link;
-
- if ((link = (cet_ucs4_link_t*)vec->ucs4_link)) {
- int i, j;
-
- for (i = 0, j = 1; j < vec->ucs4_links; i++, j++) {
- if (link[i].value >= link[j].value) {
- printf(MYNAME ": checked 0x%04x with 0x%04x\n", link[i].value, link[j].value);
- fatal(MYNAME ": \"%s\"-link-table unsorted !!!\n", vec->name);
- }
-
- }
- }
- if ((link = (cet_ucs4_link_t*)vec->ucs4_extra)) {
- int i, j;
-
- for (i = 0, j = 1; j < vec->ucs4_extras; i++, j++) {
- if (link[i].value >= link[j].value) {
- printf(MYNAME ": check 0x%04x with 0x%04x\n", link[i].value, link[j].value);
- fatal(MYNAME ": \"%s\"-extra-table unsorted !!!\n", vec->name);
- }
-
- }
- }
-}
-
-#endif
-
static signed int
cet_cs_alias_qsort_cb(const void* a, const void* b)
{
printf(", done.\n");
}
}
-
-
-/* %%% cet_fprintf / cet_vfprintf %%%
- *
- * - print any special hard-coded characters from inside a module - */
-
-int cet_gbfprintf(gbfile* stream, const cet_cs_vec_t* src_vec, const char* fmt, ...)
-{
- int res;
- char* cout;
- va_list args;
-
- va_start(args, fmt);
- xvasprintf(&cout, fmt, args);
- va_end(args);
-
- if (global_opts.charset != src_vec) {
- if (src_vec != &cet_cs_vec_utf8) {
- char* ctemp = cet_str_any_to_utf8(cout, src_vec);
- xfree(cout);
- cout = ctemp;
- }
- if (global_opts.charset != &cet_cs_vec_utf8) {
- char* ctemp = cet_str_utf8_to_any(cout, global_opts.charset);
- xfree(cout);
- cout = ctemp;
- }
- }
-
- res = gbfprintf(stream, "%s", cout);
- xfree(cout);
-
- return res;
-}
char buff[16];
short track_count, waypoint_count;
double first_lat, first_lon, lat_scale, lon_scale, amt;
- short* lon_delta, *lat_delta;
int i, j;
route_head* track_temp;
Waypoint* waypoint_temp;
waypoint_count = gbfgetint16(tpo_file_in);
/* allocate temporary memory for the waypoint deltas */
- lon_delta = (short*) xmalloc(waypoint_count * sizeof(short));
- lat_delta = (short*) xmalloc(waypoint_count * sizeof(short));
+ std::vector<short> lat_delta(waypoint_count);
+ std::vector<short> lon_delta(waypoint_count);
- for (j=0; j<waypoint_count; j++) {
+ for (j = 0; j < waypoint_count; j++) {
/* get this point's longitude delta from the first waypoint */
lon_delta[j] = gbfgetint16(tpo_file_in);
gbfread(&buff[0], 1, 2, tpo_file_in);
/* multiply all the deltas by the scaling factors to determine the waypoint positions */
- for (j=0; j<waypoint_count; j++) {
+ for (j = 0; j < waypoint_count; j++) {
waypoint_temp = new Waypoint;
track_add_wpt(track_temp, waypoint_temp);
}
-
- /* free temporary memory */
- xfree(lon_delta);
- xfree(lat_delta);
}
}
int lon;
unsigned int altitude;
-
//UNKNOWN DATA LENGTH
(void)tpo_read_int(); // 0x00